<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Zofund JobDispatcher</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <script src="assets/js/echarts.min.js"></script>
    <link rel="stylesheet" href="assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="assets/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="assets/css/app.css">
    <script src="assets/js/jquery.min.js"></script>

</head>

<body data-type="historyjob-list">
    <script src="assets/js/theme.js"></script>
    <div class="am-g tpl-g">
        <!-- 头部 -->
        <header>
            <div class="am-fl tpl-header-logo">
                <div class="am-fl tpl-header-switch-button am-icon-list"><span></span></div>
            </div>
        </header>
        <!-- 风格切换 -->
        <div class="tpl-skiner">
            <div class="tpl-skiner-toggle am-icon-cog">
            </div>
            <div class="tpl-skiner-content">
                <div class="tpl-skiner-content-title">
                    选择主题
                </div>
                <div class="tpl-skiner-content-bar">
                    <span class="skiner-color skiner-white" data-color="theme-white"></span>
                    <span class="skiner-color skiner-black" data-color="theme-black"></span>
                </div>
            </div>
        </div>
        <!-- 侧边导航栏 -->
        <div class="left-sidebar">
            <!-- 菜单 -->
            <ul class="sidebar-nav">
                <li class="sidebar-nav-link">
                    <a href="index.html">
                        <i class="am-icon-home sidebar-nav-link-logo"></i> 首页
                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="historyjob-list.html" class="active">
                        <i class="am-icon-table sidebar-nav-link-logo"></i>历史Job
                    </a>
                </li>
               <li class="sidebar-nav-link">
                    <a href="jobeditor.html">
                        <i class="am-icon-table sidebar-nav-link-logo"></i>job编辑器
                    </a>
                </li>
               <!--  <li class="sidebar-nav-link">
                    <a href="tables.html">
                        <i class="am-icon-table sidebar-nav-link-logo"></i> 表格
                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="calendar.html">
                        <i class="am-icon-calendar sidebar-nav-link-logo"></i> 日历
                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="form.html">
                        <i class="am-icon-wpforms sidebar-nav-link-logo"></i> 表单

                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="chart.html">
                        <i class="am-icon-bar-chart sidebar-nav-link-logo"></i> 图表

                    </a>
                </li>

                <li class="sidebar-nav-heading">Page<span class="sidebar-nav-heading-info"> 常用页面</span></li>
                <li class="sidebar-nav-link">
                    <a href="javascript:;" class="sidebar-nav-sub-title active">
                        <i class="am-icon-table sidebar-nav-link-logo"></i> 数据列表
                        <span class="am-icon-chevron-down am-fr am-margin-right-sm sidebar-nav-sub-ico sidebar-nav-sub-ico-rotate"></span>
                    </a>
                    <ul class="sidebar-nav sidebar-nav-sub" style="display: block;">
                        <li class="sidebar-nav-link">
                            <a href="table-list.html" class="sub-active">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 文字列表
                            </a>
                        </li>

                        <li class="sidebar-nav-link">
                            <a href="table-list-img.html">
                                <span class="am-icon-angle-right sidebar-nav-link-logo"></span> 图文列表
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="sidebar-nav-link">
                    <a href="sign-up.html">
                        <i class="am-icon-clone sidebar-nav-link-logo"></i> 注册
                        <span class="am-badge am-badge-secondary sidebar-nav-link-logo-ico am-round am-fr am-margin-right-sm">6</span>
                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="login.html">
                        <i class="am-icon-key sidebar-nav-link-logo"></i> 登录
                    </a>
                </li>
                <li class="sidebar-nav-link">
                    <a href="404.html">
                        <i class="am-icon-tv sidebar-nav-link-logo"></i> 404错误
                    </a>
                </li> -->

            </ul>
        </div>


        <!-- 内容区域 -->
        <div class="tpl-content-wrapper">
            <div class="row-content am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title  am-cf">历史Job列表</div>


                            </div>
                            <div class="widget-body  am-fr">
                                <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                <div class="am-u-sm-3 am-u-md-3 am-u-lg-3">
  										<p><input type="text" id="startDate" class="am-form-field" placeholder="开始日期" data-am-datepicker readonly required /></p>
                                </div>
                                <div class="am-u-sm-3 am-u-md-3 am-u-lg-3">
  										<p><input type="text" id="endDate" class="am-form-field" placeholder="结束日期" data-am-datepicker readonly required /></p>
                                </div>
                                <div class="am-u-sm-3 am-u-md-3 am-u-lg-3">
                                        <input type="text" id="jobCode" class="am-form-field " placeholder="JobCode">
                                </div>
                                <span class="am-input-group-btn">
            							<button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"
            							 type="button" onclick="refreshHisJob(0)"></button>
          						</span>
                                </div>

                                <div class="am-u-sm-12">
                                    <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " id="example-r">
                                        <thead>
                                            <tr>
                                                <th>JobCode</th>
                                                <th>批次号</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody id="history-jobs">
                                        </tbody>
                                    </table>
                                </div>
                                <div class="am-u-lg-12 am-cf" >

                                    <div class="am-fr">
                                        <ul class="am-pagination tpl-pagination" id="history-jobs-pagetag">
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    <script src="assets/js/amazeui.min.js"></script>
    <script src="assets/js/amazeui.datatables.min.js"></script>
    <script src="assets/js/dataTables.responsive.min.js"></script>
    <script src="assets/js/app.js"></script>
    <script>
    $(function(){ 
            var jobCode = "";
    	    $("#startDate").attr("value",getNowFormatDate(24*60*60*1000));
    	    $("#endDate").attr("value",getNowFormatDate(0));
            refreshHisJob(0);
  	});
    
    function refreshHisJob(pageNum){
        var pageSize= 10;
        var startDate = $("#startDate").val(); 
        var endDate = $("#endDate").val(); 
        var jobCode = $("#jobCode").val();
       	var params = "startDate="+startDate+"&endDate="+endDate+"&pageNum="+pageNum+"&pageSize="+pageSize;
       	if(""!=jobCode){
       		params = params + "&jobCode="+jobCode;
       	}
       	
    	$.ajax({
            type: "GET",
            url: "monitor/jobhistory?"+params,
            success: function(data){
               	var htmlStr = "";
               	for(var idx in data){
               		var quartzJob = data[idx];
               		htmlStr = htmlStr+'<tr>';
               		htmlStr = htmlStr+"<td>" + quartzJob.jobCode+"</td>";
               		htmlStr = htmlStr+"<td>" + quartzJob.eventTime+"</td>";
               		htmlStr = htmlStr+ '<td>'+
               						   '<button type="button" class="am-btn am-btn-primary  am-btn-block tpl-btn-bg-color-success"'+
               						   'onclick="javascript:openUrl(\'jobdetail.html?ifhis=1&jobcode='+ quartzJob.jobCode +'&eventtime='+quartzJob.eventTime+'\')">查看</button>'+
               		                   '</td>';
               		htmlStr = htmlStr+"</tr>";
               	}
               	$("#history-jobs").html(htmlStr);
               	var pageStr = '';
               	if(Number(pageNum)>1){
                   	pageStr = pageStr + '<li class="am-active"><a onclick="refreshHisJob(\''+(Number(pageNum)-1)+'\')">上一页</a></li>';
               	}
               	pageStr = pageStr + '<li class="am-active"><a onclick="refreshHisJob(\''+Number(pageNum)+'\')">'+pageNum+'</a></li>';
               	pageStr = pageStr + '<li class="am-active"><a onclick="refreshHisJob(\''+(Number(pageNum)+1)+'\')">下一页</a></li>';
               	$("#history-jobs-pagetag").html(pageStr);
                   }
             });
    }
    </script>

</body>

</html>